package com.example.front.controller;

import com.example.service.model.Test;
import com.example.service.service.TestService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/test/")
public class TestController {

    @Autowired
    private TestService testService;

    // @RequestMapping(value = "index")
    // public String index(){
    //     return "index";
    // }

    @RequestMapping(value = "insert")
    public void insert(@RequestBody Test test){
        testService.insert(test);
    }

    @ResponseBody
    @RequestMapping(value = "query")
    public List<Test> query(@RequestBody Test test){
        return testService.query(test);
    }

    @ResponseBody
    @RequestMapping(value = "selectById")
    public Test selectById(@RequestBody Test test){
        return testService.selectById(test);
    }
}
